class Solution(object):
    def numDifferentIntegers(self, word):
        n = len(word)
        left = 0
        right = 0
        a = set()
        while right < n:
            if 'a' <= word[right] <= 'z':
                if right > left:
                    num = int(word[left: right])
                    a.add(num)
                left = right + 1
            right += 1
        if right > left:
            num = int(word[left:])
            a.add(num)
        return len(a)